package com.dqx.haoqiu.mvp.module.guide;

import android.content.Context;
import android.os.Bundle;

import androidx.viewpager.widget.ViewPager;

import com.dqx.haoqiu.mvp.R;
import com.dqx.haoqiu.mvp.common.base.BaseActivity;
import com.dqx.haoqiu.mvp.module.guide.dagger.DaggerGuideComponent;
import com.dqx.haoqiu.mvp.module.guide.dagger.GuideModule;

import butterknife.BindView;
import butterknife.ButterKnife;

import static com.dqx.haoqiu.mvp.common.base.BaseApplication.getAppComponent;

/**
 * 引导页
 */
public class GuideActivity extends BaseActivity<GuidePresenter> implements GuideContract.View {
    @BindView(R.id.view_pager)
    ViewPager viewPager;

    GuideAdapter adapter;
    int[] images = new int[]{R.mipmap.guide1, R.mipmap.guide2, R.mipmap.guide3, R.mipmap.guide4};

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_guide);
        ButterKnife.bind(this);

        adapter = new GuideAdapter(getSupportFragmentManager(), images);
        viewPager.setAdapter(adapter);
    }

    @Override
    protected void attachBaseContext(Context newBase) {
        super.attachBaseContext(newBase);
        DaggerGuideComponent.builder()
                .appComponent(getAppComponent())
                .guideModule(new GuideModule(this))
                .build().inject(this);
    }

    /**
     * 不支持侧滑退出
     *
     * @return
     */
    @Override
    public boolean supportSlideBack() {
        return false;
    }

    /**
     * 支持沉浸式
     *
     * @return
     */
    @Override
    public boolean supporTimmersion() {
        return true;
    }

    /**
     * 设置状态栏背景色为白色
     *
     * @return
     */
    @Override
    public int statusBarResource() {
        return R.color.transparent;
    }

    /**
     * 隐藏标题栏
     *
     * @return
     */
    @Override
    public boolean setTitleBarVisable() {
        return false;
    }
}
